<link rel="stylesheet" type="text/css" href="../Another/Style/hienthisp.css"/>
<?php
	include"connection.php";
	$sql="Select * from sanpham s,loaisanpham l,nhomsanpham n ,thuonghieu t ,khuyenmai k
	where  s.MaKhuyenMai=k.MaKhuyenMai and s.MaLoai=l.MaLoai and l.MaNhom=n.MaNhom and l.MaNhom='2' and s.MaThuongHieu=t.MaThuongHieu
	order by NgayNhap
	LIMIT 0,3";
	$result=mysql_query($sql) or die("Cound not select to SanphamDB!".mysql_error($con));
	   echo"<table border='0'>";
	   echo"<tr>";
		while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
			echo '<td>';
			echo '<div id="o_sanpham">';
				if($row["MaKhuyenMai"]!=1){echo '<div class="giamgia">-'.$row["HinhThuc"].'%</div>';}
				echo '<div class="hinhanh_minhhoa"><a href="../MyModel/ChiTiet.php?MSP='.$row["MaSanPham"].'"><img width="180px" height="235px"src="'.$row["HinhAnhSP"].'" alt="image" /></a></div>';
				echo '<div class="tenthuonghieu"><a href="../MyModel/ChiTiet.php?MSP='.$row["MaSanPham"].'">'.$row["TenThuongHieu"].'</a></div>';
				echo '<div class="details">';
					echo '<div class="gia"><span class="giacu">'.number_format($row['DonGiaDuKien'],3).' VNĐ</span> <br />';
					echo '<span class="giamoi">'.number_format(($row['DonGiaDuKien'] - ($row["DonGiaDuKien"]*$row["HinhThuc"])/100),3).' VNĐ</span></div>';
					echo '<a href="../MyModel/ChiTiet.php?MSP='.$row["MaSanPham"].'"><div class="xemchitiet"></div></a>';
    			echo '</div>';
			echo '</div>';
			echo '</td>'; 
		}
		echo "</tr>";
		echo "</table>";	
	mysql_close($con);
?>